package testClient;


import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.GridBagLayout;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import java.awt.event.HierarchyListener;
import java.awt.event.HierarchyEvent;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JPopupMenu;
import java.awt.Component;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.ButtonGroup;
import javax.swing.KeyStroke;
import java.awt.event.KeyEvent;
import javax.swing.JProgressBar;
import javax.swing.JButton;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.SwingConstants;

import testClient.Client1;


import java.awt.event.ActionListener;

import java.awt.event.ActionEvent;
import java.awt.Font;


public class Home extends JFrame {

	private JPanel contentPane;
	private final ButtonGroup buttonGroup = new ButtonGroup();

	/**
	 * Launch the application.
	 */
//	public static void main(String[] args) {
//		EventQueue.invokeLater(new Runnable() {
//			public void run() {
//				try {
//					Home frame = new Home();
//					frame.setVisible(true);
//				} catch (Exception e) {
//					e.printStackTrace();
//				}
//			}
//		});
//	}

	/**
	 * Create the frame.
	 */
	public Home() {
		setTitle("Home");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 679, 476);
		
		JMenuBar menuBar = new JMenuBar();
		setJMenuBar(menuBar);
		
		JMenu mnMenu = new JMenu(Client1.getText("Menu"));
		menuBar.add(mnMenu);
		
		JMenu mnImport = new JMenu(Client1.getText("Import"));
		mnMenu.add(mnImport);
		
		JMenuItem mntmDaten = new JMenuItem(Client1.getText("Daten"));
		mnImport.add(mntmDaten);
		
		JMenuItem mntmNewMenuItem = new JMenuItem(Client1.getText("Ambience"));
		mnImport.add(mntmNewMenuItem);
		
		JMenu mnExport = new JMenu(Client1.getText("Export"));
		mnMenu.add(mnExport);
		
		JMenuItem mntmFrage = new JMenuItem(Client1.getText("Fragen"));
		mnExport.add(mntmFrage);
		
		JMenuItem mntmUser = new JMenuItem(Client1.getText("User"));
		mnExport.add(mntmUser);
		
		JMenuItem mntmMandanten = new JMenuItem(Client1.getText("Mandanten"));
		mnExport.add(mntmMandanten);
		
		JMenuItem mntmKategorien = new JMenuItem(Client1.getText("Kategorien"));
		mnExport.add(mntmKategorien);
		
		JMenuItem mntmHexagramme = new JMenuItem(Client1.getText("Hexagramme"));
		mnExport.add(mntmHexagramme);
		
		JMenu mnUser = new JMenu(Client1.getText("User"));
		mnMenu.add(mnUser);
		
		JMenuItem mntmBearbeiten = new JMenuItem(Client1.getText("bearbeiten"));
		mnUser.add(mntmBearbeiten);
		mntmBearbeiten.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
//	        		UserEinstellungen us = new UserEinstellungen();
//	        		us.setVisible(true);
				}
		});
		
		
		JMenuItem mntmNewMenuItem_1 = new JMenuItem(Client1.getText("registrieren"));
		mnUser.add(mntmNewMenuItem_1);
		mntmNewMenuItem_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
//        		UserEinstellungen us = new UserEinstellungen();
//        		us.setVisible(true);
			}
	});
		
		JMenu mnMandant = new JMenu(Client1.getText("Mandant"));
		mnMenu.add(mnMandant);
		
		JMenuItem mntmNewMenuItem_2 = new JMenuItem(Client1.getText("erstellen"));
		mnMandant.add(mntmNewMenuItem_2);
		
		JMenuItem mntmNewMenuItem_3 = new JMenuItem(Client1.getText("bearbeiten"));
		mnMandant.add(mntmNewMenuItem_3);
		
		JMenu mnKategorie = new JMenu(Client1.getText("Kategorie"));
		mnMenu.add(mnKategorie);
		
		JMenuItem mntmErstellen = new JMenuItem(Client1.getText("erstellen"));
		mnKategorie.add(mntmErstellen);
		
		JMenuItem mntmBearbeiten_1 = new JMenuItem(Client1.getText("bearbeiten"));
		mnKategorie.add(mntmBearbeiten_1);
		
		JMenu mnThema = new JMenu(Client1.getText("Thema"));
		mnMenu.add(mnThema);
		
		JMenuItem mntmErstellen_1 = new JMenuItem(Client1.getText("erstellen"));
		mnThema.add(mntmErstellen_1);
		
		JMenuItem mntmBearbeiten_2 = new JMenuItem(Client1.getText("bearbeiten"));
		mnThema.add(mntmBearbeiten_2);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		
		JButton btnNewButton = new JButton(Client1.getText("neueFrageStellen"));
		btnNewButton.setBounds(35, 35, 296, 29);
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
//				Fragestellen fs = new Fragestellen();
//				fs.setVisible(true);
				dispose();
			}
		});
		contentPane.setLayout(null);
		btnNewButton.setHorizontalAlignment(SwingConstants.LEFT);
		contentPane.add(btnNewButton);
		
//		JButton btnNewButton_1 = new JButton("Bestehende Frage ausw\u00E4hlen/bearbeiten");
		JButton btnNewButton_1 = new JButton(Client1.getText("BestehendeFrageSuchen"));
		btnNewButton_1.setHorizontalAlignment(SwingConstants.LEFT);
		btnNewButton_1.setBounds(35, 99, 296, 29);
		contentPane.add(btnNewButton_1);
		btnNewButton_1.addActionListener(new ActionListener () {
			public void actionPerformed(ActionEvent e) {
//				Frage_suchen fs = new Frage_suchen();
//				fs.setVisible(true);
				dispose();
			}
		});
		
		
		JButton btnNewButton_2 = new JButton(Client1.getText("Bibliothek"));
		btnNewButton_2.setBounds(35, 163, 296, 29);
		btnNewButton_2.setHorizontalAlignment(SwingConstants.LEFT);
		btnNewButton_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
//				Bibliothek b = new Bibliothek();
//				b.setVisible(true);
			}
			
		});
		
		contentPane.add(btnNewButton_2);
		
		JButton btnNewButton_3 = new JButton(Client1.getText("FAQ"));
		btnNewButton_3.setBounds(35, 227, 296, 29);
		btnNewButton_3.setHorizontalAlignment(SwingConstants.LEFT);
		contentPane.add(btnNewButton_3);
		
		JButton btnNewButton_4 = new JButton(Client1.getText("Abmelden"));
		btnNewButton_4.setBounds(35, 291, 296, 29);
		btnNewButton_4.setHorizontalAlignment(SwingConstants.LEFT);
		
		btnNewButton_4.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
//				login l = new login();
//				l.setVisible(true);
				dispose();
			}

			
		});
	
		contentPane.add(btnNewButton_4);
		
			
		JButton btnNewButton_5 = new JButton(Client1.getText("Beenden"));
		btnNewButton_5.setFont(new Font("Tahoma", Font.PLAIN, 13));
		btnNewButton_5.setBounds(35, 355, 296, 29);
		btnNewButton_5.setHorizontalAlignment(SwingConstants.LEFT);
		btnNewButton_5.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				System.exit(0);
			}
		});
		contentPane.add(btnNewButton_5);
		
	}

	private static void addPopup(Component component, final JPopupMenu popup) {
		component.addMouseListener(new MouseAdapter() {
			public void mousePressed(MouseEvent e) {
				if (e.isPopupTrigger()) {
					showMenu(e);
				}
			}
			public void mouseReleased(MouseEvent e) {
				if (e.isPopupTrigger()) {
					showMenu(e);
				}
			}
			private void showMenu(MouseEvent e) {
				popup.show(e.getComponent(), e.getX(), e.getY());
			}
		});
	}
}
